package com.ewili.x.special.service.data.impl;

import com.ewili.x.special.dao.inter.StockDao;
import com.ewili.x.special.entity.Stock;
import com.ewili.x.special.service.data.inter.AmountStockService;
import com.ewili.x.special.task.thread.inter.AmountStockThreadTask;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AmountStockServiceImpl implements AmountStockService {

    @Autowired
    private StockDao stockDao;

    @Autowired
    private AmountStockThreadTask amountStockThreadTask;


    @Override
    public void spide() {
        List<Stock> stocks = stockDao.findAll();
        for (Stock stock : stocks) {
            String code = stock.getCode();
            amountStockThreadTask.doSpide(code);
        }
    }
}
